// Test-specific parameters - must be defined BEFORE includeConfig
params {
    // DIA-NN Configuration Parameters (matching quantms defaults)
    diann_debug             = 3
    scan_window             = 8
    scan_window_automatic   = true
    performance_mode        = true
    quick_mass_acc          = true
    mass_acc_automatic      = true
    pg_level                = 1  // Use protein groups (1) instead of genes (2) for better compatibility with limited data
    species_genes           = false
    diann_normalize         = true
    diann_report_decoys     = false
    diann_export_xic        = false
    enable_diann_mztab      = true

    // Library generation parameters (matching quantms defaults)
    min_pr_mz               = 350
    max_pr_mz               = 950
    min_fr_mz               = 500
    max_fr_mz               = 1500
    allowed_missed_cleavages = 1
    min_peptide_length      = 15
    max_peptide_length      = 30
    min_precursor_charge    = 2
    max_precursor_charge    = 3
    max_mods                = 2

    // Protein level FDR cutoff - permissive for testing
    protein_level_fdr_cutoff = 1.0
}

// Include the main subworkflow configuration AFTER params are defined
includeConfig '../nextflow.config'

// Test-specific process overrides
process {
    // Override DIANN_FINALQUANTIFICATION with permissive matrix filters for minimal test data
    withName: '.*:DIANN_FINALQUANTIFICATION' {
        ext.prefix = 'diann_report'
        ext.args = [
            params.diann_debug ? "--verbose ${params.diann_debug}" : '',
            "--relaxed-prot-inf",
            params.pg_level != null ? "--pg-level ${params.pg_level}" : '',
            params.species_genes ? "--species-genes" : '',
            "--matrices",
            params.protein_level_fdr_cutoff != null ? "--qvalue ${params.protein_level_fdr_cutoff}" : '',
            "--matrix-qvalue 1",  // Test-specific: Permissive global protein q-value filter for minimal test data
            params.diann_report_decoys ? "--report-decoys" : '',
            params.diann_export_xic ? "--xic" : '',
            params.scan_window_automatic ? "--individual-windows" : (params.scan_window ? "--window ${params.scan_window}" : '')
        ].findAll { it != '' }.join(' ').trim()
    }
}
